/***************************** BEGIN LICENSE BLOCK ***************************

 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/MPL-1.1.html
 
 Software distributed under the License is distributed on an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 for the specific language governing rights and limitations under the License.
 
 The Original Code is the "EO-SPS Framework".
 
 The Initial Developer of the Original Code is Spotimage S.A.
 Portions created by the Initial Developer are Copyright (C) 2007
 the Initial Developer. All Rights Reserved.
 
 Contributor(s): 
    Alexandre Robin <alexandre.robin@spotimage.fr>
 
******************************* END LICENSE BLOCK ***************************/

package com.spotimage.eosps;

import org.vast.cdm.common.DataComponent;
import org.vast.data.DataValue;
import org.vast.ows.sps.StatusReport;
import org.vast.ows.sps.TaskingResponse;


/**
 * <p><b>Title:</b><br/>
 * EO Optical Report Helper
 * </p>
 *
 * <p><b>Description:</b><br/>
 * Helper to get and set extended data specific to spaceborne earth
 * observation optical instruments from/to SPS responses.
 * This class must be constructed from an existing GetFeasibility,
 * Submit, GetStatus, Update, Reserve or Confirm response (for instance
 * as obtained using the generic SPS deserializers).
 * 
 * TODO implement unit conversion in all get/set methods dealing with 
 * decimal values
 * 
 * </p>
 *
 * <p>Copyright (c) 2008, Spot Image</p>
 * @author Alexandre Robin <alexandre.robin@spotimage.fr>
 * @date Dec, 18th 2008
 * @since 1.0
 */
public class EOOpticalReportHelper extends EOReportHelper implements EOOpticalConstants
{
	
	public EOOpticalReportHelper(StatusReport report)
	{
		super(report);
	}
		
	
	public EOOpticalReportHelper(TaskingResponse response)
	{
		super(response);
	}
	
	
	public EOOpticalReportHelper(StatusReport report, DataComponent reportParams)
	{
		super(report, reportParams);
	}
	
	
	public EOOpticalReportHelper(TaskingResponse response, DataComponent reportParams)
	{
		super(response, reportParams);
	}
	
	
	/**
	 * Finds segment luminosity in report structure 
	 * @return
	 */
	public DataValue findLuminosity()
	{
		DataComponent param = this.findParameterByDefinition(LUMINOSITY_URI);
		return (DataValue) param;
	}

	public double getLuminosity()
	{
		DataValue param = findLuminosity();
		if (param != null)
			return param.getData().getDoubleValue();
		
		return Double.NaN;
	}

	public void setLuminosity(double luminosity)
	{
		DataValue param = findLuminosity();
		if (param != null)
			param.getData().setDoubleValue(luminosity);
	}
}
